/*******************************************************************************
 * Copyright (c) 2006 CEA List.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     CEA List - initial API and implementation
 *******************************************************************************/
package com.cea.papyrus.diagram.usecase.figure;

import org.eclipse.draw2d.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontData;

import com.cea.papyrus.core.PapyrusPlugin;
import com.cea.papyrus.diagraminterchange2.di2.GraphElement;

public class UseCaseStringFigure extends Label {

	protected String name="";
	
	protected String stereotypes="";


	public UseCaseStringFigure(String name)	{ 
		super(name);
		FontData[] font = {new FontData("Arial", 10, SWT.NORMAL)};
		setFont(PapyrusPlugin.fontManager.get(font));
	}

	/**
	 * diplay the property.
	 */
	protected void display(){
		setText(stereotypes+" "+name);
	}
	
	public void setName(String text){
		name=text;
		display();
	}
	public void setStereotypes(String st){
		if (st==null) {
			this.stereotypes="";
		} else {
			this.stereotypes=PapyrusPlugin.ST_LEFT+st+PapyrusPlugin.ST_RIGHT;
		}
		display();
	}

	/**
	 * Refresh colors.
	 * 
	 * @param graphElement the graph element
	 */
	public void refreshColors(GraphElement graphElement) {
		setForegroundColor(PapyrusPlugin.colorManager.get(graphElement.getFontColor()));
		setFont(PapyrusPlugin.fontManager.get(new FontData[]{new FontData(graphElement.getFontFamily(),graphElement.getFontSize(),SWT.NORMAL)}));
	}
}